import { myEnv } from '@/myEnv';
import { mergeRequest } from '@/utils';

/** 获取图片验证码 */
export const apiGetImgCaptcha = async (userPhoneNumber:string) => {
    const response: MyResponse<any> = await sendRequest(userPhoneNumber);
    if(!response) return
    return response.data;
};

const sendRequest = async (userPhoneNumber) => {
    let response: MyResponse<any>;
    if (myEnv.IS_ON_LINE) {
        response = await mergeRequest({
            url: `login/get-captcha?userPhoneNumber=${userPhoneNumber}`,
            method: 'GET',
        });
    } else {
        response = {
            code: '200',
            message: 'ok',
            data: '<svg xmlns="http://www.w3.org/2000/svg" width="150" height="50" viewBox="0,0,150,50"><path fill="#333" d="M112.29 33.24L112.28 33.23L112.25 33.20Q112.18 36.10 111.00 40.74L111.01 40.76L111.07 40.82Q109.28 41.35 107.68 42.14L107.69 42.16L107.71 42.18Q110.19 35.03 109.93 27.60L109.96 27.64L109.95 27.63Q109.63 20.19 106.55 13.45L106.67 13.58L106.67 13.58Q108.58 14.80 110.45 15.37L110.47 15.40L110.52 15.44Q112.61 22.37 112.61 29.04L112.60 29.02L112.65 29.07Q112.62 30.49 112.55 31.98L112.58 32.00L112.54 31.97Q113.62 30.69 118.84 25.74L118.86 25.76L118.79 25.69Q120.04 25.84 121.03 25.77L120.96 25.70L123.09 25.58L123.08 25.57Q119.80 28.45 115.49 32.22L115.62 32.34L115.53 32.25Q119.02 35.14 125.50 40.97L125.38 40.85L125.36 40.83Q122.61 39.90 119.64 39.71L119.80 39.88L119.75 39.83Q117.12 37.62 112.25 33.20ZM122.25 42.48L122.31 42.53L122.30 42.53Q126.99 43.33 130.11 45.28L130.06 45.23L130.12 45.29Q128.91 43.96 126.28 41.56L126.27 41.54L126.34 41.62Q126.45 41.58 126.72 41.69L126.78 41.75L126.87 41.84Q124.77 39.82 122.52 37.92L122.34 37.73L117.93 33.85L118.02 33.94Q122.94 29.69 125.37 26.80L125.50 26.92L125.33 26.75Q124.10 26.81 121.62 27.08L121.73 27.19L121.67 27.13Q123.31 25.72 124.00 24.89L124.00 24.89L124.04 24.93Q121.26 25.42 118.79 25.42L118.83 25.47L118.74 25.38Q117.28 26.62 114.54 29.28L114.69 29.44L114.53 29.28Q114.55 23.51 113.56 17.69L113.62 17.75L113.66 17.78Q112.89 17.55 111.41 17.29L111.35 17.23L111.46 17.33Q111.25 16.55 110.79 15.07L110.85 15.13L110.88 15.15Q108.07 14.18 105.83 12.62L105.87 12.66L106.00 12.79Q109.40 19.58 109.74 27.69L109.67 27.62L109.65 27.60Q110.08 35.60 107.07 42.83L107.07 42.84L106.93 42.69Q107.74 42.52 109.08 41.87L109.03 41.82L109.13 41.92Q108.78 42.64 108.13 44.09L108.20 44.16L108.12 44.07Q111.07 43.10 113.20 42.72L113.03 42.55L113.08 42.59Q113.58 40.01 114.07 35.75L114.18 35.86L114.18 35.85Q116.85 38.18 122.29 42.52Z"/><path fill="#333" d="M23.82 30.56L23.86 30.61L23.92 30.67Q23.96 30.70 27.34 30.66L27.37 30.69L27.33 30.65Q29.50 30.53 30.57 30.57L30.69 30.69L30.54 30.55Q29.61 27.79 27.17 22.15L27.10 22.08L27.17 22.15Q26.61 23.57 25.56 26.43L25.58 26.44L25.48 26.34Q24.52 29.28 23.94 30.69ZM31.70 33.08L31.68 33.05L31.74 33.11Q29.36 32.98 27.15 33.02L27.30 33.17L27.17 33.04Q24.98 33.14 22.70 33.33L22.66 33.29L22.78 33.41Q21.26 36.83 18.02 41.02L18.02 41.02L18.05 41.05Q15.44 41.64 14.07 42.13L13.95 42.02L14.05 42.11Q19.18 36.47 23.86 23.11L23.77 23.02L23.83 23.08Q24.94 19.51 26.31 16.27L26.37 16.32L26.35 16.30Q26.72 16.38 27.07 16.38L27.00 16.31L27.80 16.39L27.78 16.36Q28.56 17.76 33.40 29.40L33.44 29.45L33.39 29.40Q36.69 37.27 40.69 41.42L40.56 41.29L40.71 41.44Q40.13 41.24 36.25 40.37L36.32 40.44L36.28 40.40Q33.81 37.36 31.83 33.21ZM36.11 40.65L36.10 40.63L36.83 40.88L36.78 40.82Q36.99 40.80 37.29 40.91L37.42 41.04L37.31 40.93Q37.63 41.29 39.46 43.31L39.59 43.44L39.53 43.38Q43.19 44.30 45.59 45.33L45.49 45.23L45.42 45.16Q40.08 40.77 36.08 32.77L36.02 32.71L35.99 32.68Q34.30 29.32 32.85 25.36L32.85 25.36L30.21 17.96L30.23 17.98Q29.96 18.06 29.74 18.06L29.68 18.00L29.23 18.08L29.22 18.08Q28.82 17.37 28.10 16.00L27.98 15.88L28.16 16.06Q27.63 16.06 27.17 16.03L27.13 15.99L27.22 16.07Q26.67 15.94 26.14 15.94L26.21 16.02L26.04 15.84Q24.64 19.77 20.75 29.93L20.91 30.09L20.88 30.06Q17.74 38.00 13.09 42.80L12.98 42.68L13.06 42.76Q14.11 42.36 16.12 41.75L16.17 41.80L16.17 41.80Q15.43 42.69 13.87 44.48L13.75 44.37L13.82 44.43Q15.50 43.76 19.42 43.00L19.53 43.11L19.53 43.10Q22.91 38.71 24.47 35.48L24.46 35.47L24.52 35.53Q26.17 35.31 28.49 35.35L28.52 35.38L28.53 35.39Q31.29 35.44 32.66 35.52L32.60 35.46L32.54 35.40Q33.86 37.83 36.22 40.76ZM28.50 26.07L28.53 26.10L28.38 25.95Q29.35 28.14 30.11 30.23L30.17 30.29L26.76 30.19L26.81 30.24Q27.30 28.71 28.37 25.94Z"/><path fill="#222" d="M86.05 40.22L86.01 40.17L83.65 33.37L83.60 33.32Q79.26 20.76 73.33 14.36L73.31 14.35L73.26 14.29Q75.29 15.38 77.88 15.99L77.95 16.05L77.82 15.92Q83.09 22.34 87.43 35.09L87.33 34.99L87.43 35.09Q90.42 26.92 91.11 25.33L91.09 25.31L91.22 25.44Q93.60 19.82 96.42 16.51L96.32 16.42L96.40 16.50Q98.38 16.04 101.00 15.16L101.00 15.15L100.92 15.08Q96.54 19.87 93.49 27.10L93.33 26.94L93.48 27.09Q92.00 30.67 88.31 40.19L88.29 40.17L88.24 40.12Q87.75 40.20 87.18 40.16L87.21 40.20L87.22 40.21Q86.67 40.23 86.10 40.27ZM90.95 42.53L91.07 42.65L90.96 42.54Q93.79 32.58 95.35 28.54L95.39 28.59L95.33 28.53Q98.39 20.89 102.81 16.01L102.73 15.94L102.89 16.10Q101.73 16.35 99.64 17.07L99.63 17.06L100.77 15.73L100.79 15.75Q101.36 15.06 101.97 14.41L102.06 14.50L101.97 14.41Q99.25 15.50 96.24 16.07L96.21 16.04L96.28 16.11Q91.79 21.32 87.90 32.78L87.95 32.83L87.86 32.74Q84.28 22.68 81.08 18.31L81.17 18.40L81.11 18.33Q80.63 18.16 79.75 18.01L79.91 18.17L79.78 18.03Q79.50 17.60 77.90 15.55L78.02 15.67L77.98 15.63Q75.07 14.97 72.37 13.56L72.23 13.42L72.41 13.60Q79.02 20.66 83.39 33.45L83.41 33.46L83.36 33.41Q84.49 36.98 85.67 40.56L85.79 40.68L85.75 40.64Q86.02 40.61 86.86 40.50L86.93 40.56L86.90 40.54Q87.24 41.21 87.92 42.55L87.86 42.49L87.91 42.54Q88.82 42.53 89.54 42.61L89.45 42.52L89.47 42.53Q90.35 42.69 91.11 42.69Z"/><path fill="#111" d="M53.49 19.31L53.56 19.38L53.59 19.41Q54.38 23.59 54.53 27.17L54.63 27.26L54.54 27.17Q55.57 27.18 56.64 27.18L56.72 27.26L58.87 27.20L58.87 27.20Q60.01 27.28 60.89 25.87L60.85 25.83L60.77 25.75Q61.57 24.64 61.68 23.46L61.58 23.36L61.62 23.41Q62.06 20.45 57.83 19.96L57.77 19.90L57.86 19.98Q56.17 19.94 53.55 19.37ZM54.48 29.85L54.64 30.01L54.54 29.92Q54.43 36.09 53.29 40.50L53.28 40.49L53.33 40.54Q51.99 41.07 49.67 42.14L49.61 42.08L49.66 42.13Q51.86 35.31 51.60 28.04L51.76 28.20L51.61 28.05Q51.46 20.81 48.68 14.38L48.60 14.31L48.53 14.24Q52.72 17.06 58.97 17.06L58.91 17.00L59.02 17.11Q65.13 17.17 65.28 20.63L65.12 20.47L65.29 20.64Q65.19 22.90 64.20 25.56L64.21 25.57L64.32 25.69Q63.87 26.76 62.92 27.98L62.82 27.88L62.87 27.92Q61.53 29.52 58.98 29.79L59.11 29.91L59.02 29.82Q56.81 29.90 54.57 29.94ZM60.75 32.24L60.63 32.12L60.68 32.17Q64.76 32.33 66.01 27.53L66.10 27.62L66.15 27.67Q67.01 23.92 66.86 21.91L66.95 21.99L66.91 21.96Q66.75 20.39 65.99 19.40L66.12 19.53L65.99 19.40Q65.75 19.15 65.25 18.93L65.21 18.88L65.17 18.84Q65.29 18.81 64.68 18.05L64.60 17.97L64.57 17.94Q63.11 16.71 59.15 16.71L59.06 16.62L59.11 16.67Q52.14 16.59 47.91 13.43L47.99 13.51L47.91 13.43Q51.12 20.55 51.38 28.01L51.31 27.94L51.31 27.94Q51.61 35.63 48.95 42.71L49.08 42.84L49.00 42.77Q50.09 42.14 51.08 41.76L51.17 41.85L50.63 42.83L50.76 42.96Q50.43 43.39 50.16 43.96L50.32 44.12L50.21 44.01Q52.58 42.92 55.48 42.38L55.50 42.41L55.48 42.39Q56.38 36.93 56.45 32.21L56.46 32.22L56.47 32.23Q57.51 32.09 58.50 32.09L58.65 32.23L58.63 32.21Q59.83 32.08 60.63 32.12ZM59.74 22.24L59.71 22.21L59.69 22.20Q60.22 22.23 61.21 22.46L61.23 22.48L61.30 22.55Q61.25 22.62 61.29 22.92L61.34 22.97L61.35 22.98Q61.41 23.27 61.33 23.54L61.29 23.50L61.33 23.53Q61.18 24.72 60.46 25.59L60.46 25.59L60.43 25.56Q59.97 26.74 58.94 26.93L58.98 26.97L58.94 26.93Q58.18 26.90 56.55 26.90L56.48 26.83L56.52 26.87Q56.57 24.67 56.34 22.31L56.24 22.21L57.95 22.24L57.98 22.28Q58.79 22.25 59.66 22.17Z"/><path d="M5 47 C66 45,75 29,149 3" stroke="#666" fill="none"/></svg>',
        };
    }
    return response;
};
